/*
 * Copyright (c) 2005 -2008 Reliable Source, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Mozilla Public License v.1.1,
 * BSD, and Eclipse Public License v1.0 which accompanies this
 * distribution and is available at:
 *
 * 		http://www.eclipse.org/legal/epl-v10.html
 * 		http://www.opensource.org/licenses/bsd-license.php
 * 		http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * Contributors:
 *     IBM Corporation	     -  http://ibm.com
 *     	- initial API and implementation
 *
 *     patientos.org         - http://patientos.org
 *     	- domain and database persistence layer
 *
 *     Reliable Source, Inc. - http://reliablesource.org
 *     	- Symbiosys Application Framework,
 *     	- Symbiosys Application, Symbiosys Product
 *
 */
package org.reliablesource.client.ui.symbiosys.platform;


/**
 *
 * SymbiosysRuntimeException.java<br>
 * Created on: Jun 27, 2008<br>
 *
 * @author <a href="mailto:dennis.park@gmail.com">Dennis Park</a>
 *
 * @category
 * @since 1.0
 */
public class SymbiosysRuntimeException extends RuntimeException {
    /**
     *
     */
    private static final long serialVersionUID = -7199867225744646544L;

    /**
     * id the error id
     */
    protected String id;

    /**
     * The blank string
     */
    private final String BLANK = "";

    /**
     * source the plugin where the error occured
     */
    protected String source = BLANK;

    /**
     * @param id
     * @param pluginId
     * @param message
     */
    public SymbiosysRuntimeException(String id, String pluginId, String message) {
        super(message);
        this.id = id;
        this.source = pluginId;
    }

    /**
     * @param id
     * @param pluginId
     * @param message
     * @param cause
     */
    public SymbiosysRuntimeException(String id, String pluginId,
        String message, Throwable cause) {
        super(message, cause);

        if ((id == null) || id.equals(BLANK))
            throw new IllegalArgumentException("Illegal Id");

        this.id = id;
        this.source = pluginId;
    }

    /**
     * Returns the error id of this error
     *
     * @return String the error id
     */
    public String getId() {
        return this.id;
    }

    /**
     * Returns the Plugin ID for this error.
     *
     * @return String the plugin where the exception occured
     */
    public String getSource() {
        return source;
    }
}
